package api_model

import "time"

func CreateTaskListFactory(sqlType string) *TaskList {
	return &TaskList{BaseModel: BaseModel{DB: UseDbConn(sqlType)}}
}

type TaskList struct {
	BaseModel
	Id                  int32     `gorm:"column:id;primary_key;AUTO_INCREMENT;NOT NULL"`
	Tid                 string    `gorm:"column:tid;NOT NULL;comment:'任务id编号'"`
	ShopId              string    `gorm:"column:shop_id;NOT NULL;comment:'店铺id'"`
	MerchantId          int32     `gorm:"column:merchant_id;NOT NULL;comment:'商家id'"`
	Terminal            string    `gorm:"column:terminal;NOT NULL;comment:'下单终端'"`
	Type                string    `gorm:"column:type;default:1;NOT NULL;comment:'0 浏览单 1成交单 2 媒体单'"`
	PushType            string    `gorm:"column:push_type;default:0;NOT NULL;comment:'0 普通发布 1 快速发布'"`
	Platform            string    `gorm:"column:platform;NOT NULL;comment:'平台'"`
	PlaceOrderPrice     float64   `gorm:"column:place_order_price;NOT NULL;comment:'最终下单价格'"`
	ActualPayment       float64   `gorm:"column:actual_payment;NOT NULL;comment:'商家实际被扣款价格'"`
	OrderCount          float64   `gorm:"column:order_count;NOT NULL;comment:'下单数量'"`
	TaskCount           int       `gorm:"column:task_count;NOT NULL;comment:'任务数量'"`
	AdditionPriceTotal  float64   `gorm:"column:addition_price_total;NOT NULL;comment:'副宝贝产品价格'"`
	BaseServicePrice    float64   `gorm:"column:base_service_price;NOT NULL;comment:'基础服务费'"`
	AccretionPriceTotal float64   `gorm:"column:accretion_price_total;NOT NULL;comment:'增值服务费'"`
	Content             string    `gorm:"column:content;default:NULL;comment:'任务内容，适用于重发/查看详情'"`
	UseAccretionDetail  string    `gorm:"column:use_accretion_detail;default:NULL;comment:'增值任务详情'"`
	MoneyRefundMethod   string    `gorm:"column:money_refund_method;default:0;NOT NULL;comment:'0平台返款 1 商家返款'"`
	TaskState           string    `gorm:"column:task_state;default:0;NOT NULL;comment:'0 进行中 1 已完成 2 暂停中 3 取消 4 定时中'"`
	State               string    `gorm:"column:state;default:1;NOT NULL;comment:'任务审核状态0 提交审核 1 审核成功 2 审核失败'"`
	Cause               string    `gorm:"column:cause;default:NULL;comment:'审核失败原因'"`
	IntervalTime        int32     `gorm:"column:interval_time;default:NULL;comment:'任务间隔时间 分钟'"`
	PushTime            time.Time `gorm:"column:push_time;default:NULL;comment:'发布时间'"`
	UpdateTime          time.Time `gorm:"column:update_time;default:CURRENT_TIMESTAMP;NOT NULL;comment:'更新状态时间'"`
	CreateTime          time.Time `gorm:"column:create_time;default:CURRENT_TIMESTAMP;NOT NULL;comment:'发布任务时间'"`
}

func (t *TaskList) TableName() string {
	return "task_list"
}
